From db45cea37e8070e1572cdc25121c46022780f51d Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Wed, 2 Feb 2022 19:36:18 +0100
Subject: temporary setup for showing submission match result

---
 .../routes/submission_matches/[match_id].svelte    | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 web/pw-server/src/routes/submission_matches/[match_id].svelte

(limited to 'web/pw-server/src/routes/submission_matches/[match_id].svelte')

diff --git a/web/pw-server/src/routes/submission_matches/[match_id].svelte b/web/pw-server/src/routes/submission_matches/[match_id].svelte
new file mode 100644
index 0000000..586b2c2
--- /dev/null
+++ b/web/pw-server/src/routes/submission_matches/[match_id].svelte
@@ -0,0 +1,31 @@
+<script lang="ts" context="module">
+  export async function load({ page }) {
+    const res = await fetch(`/api/submission_match_log/${page.params["match_id"]}`, {
+      headers: {
+        "Content-Type": "application/json",
+      },
+    });
+
+    if (res.ok) {
+      return {
+        props: {
+          matchLog: await res.text(),
+        },
+      };
+    }
+
+    return {
+      status: res.status,
+      error: new Error("failed to load match"),
+    };
+  }
+</script>
+
+<script lang="ts">
+  import Visualizer from "$lib/components/Visualizer.svelte";
+  export let matchLog: string;
+</script>
+
+<div>
+  <Visualizer {matchLog} />
+</div>
-- 
cgit v1.2.3

